import compresssionBuild from "rollup-plugin-compression";
import dayjs from "dayjs";

export default function createZip(env) {
	const { VITE_APP_ZIP_NAME } = env;
	const ZIP_DATE = dayjs(new Date()).format("YYYYMMDD-HHmm");
	const option = {
		sourceName: `dist`,
		type: "zip",
		targetName: `管理系统${VITE_APP_ZIP_NAME ? `-${VITE_APP_ZIP_NAME}` : ""}-${ZIP_DATE}`,
		ignoreBase: true, // 默认打包源文件夹本身,配置为true则只打包文件夹内文件  默认是false,
	};
	return compresssionBuild(option);
}
